<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"> <style>
	.KEYW {color: #933;}
	.COMM {color: #bbb; font-style: italic;}
	.NUMB {color: #393;}
	.STRN {color: #393;}
	.REGX {color: #339;}
	.line {border-right: 1px dotted #666; color: #666; font-style: normal;}
	</style></head><body><pre><span class='line'>  1</span> <span class="TOKN">﻿</span><span class="COMM">/*
<span class='line'>  2</span> Copyright (c) 2003-2009, CKSource - Frederico Knabben. All rights reserved.
<span class='line'>  3</span> For licensing, see LICENSE.html or http://ckeditor.com/license
<span class='line'>  4</span> */</span><span class="WHIT">
<span class='line'>  5</span>
<span class='line'>  6</span> </span><span class="COMM">/**
<span class='line'>  7</span>  * Contains UI features related to an editor instance.
<span class='line'>  8</span>  * @constructor
<span class='line'>  9</span>  * @param {CKEDITOR.editor} editor The editor instance.
<span class='line'> 10</span>  * @example
<span class='line'> 11</span>  */</span><span class="WHIT">
<span class='line'> 12</span> </span><span class="NAME">CKEDITOR.ui</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="WHIT"> </span><span class="NAME">editor</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="WHIT">
<span class='line'> 13</span> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 14</span> </span><span class="WHIT">	</span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="WHIT"> </span><span class="NAME">editor.ui</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="WHIT">
<span class='line'> 15</span> </span><span class="WHIT">		</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">editor.ui</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 16</span>
<span class='line'> 17</span> </span><span class="WHIT">	</span><span class="COMM">/**
<span class='line'> 18</span> 	 * Object used to hold private stuff.
<span class='line'> 19</span> 	 * @private
<span class='line'> 20</span> 	 */</span><span class="WHIT">
<span class='line'> 21</span> </span><span class="WHIT">	</span><span class="NAME">this._</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT">
<span class='line'> 22</span> </span><span class="WHIT">	</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 23</span> </span><span class="WHIT">		</span><span class="NAME">handlers</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 24</span> </span><span class="WHIT">		</span><span class="NAME">items</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'> 25</span> </span><span class="WHIT">	</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 26</span>
<span class='line'> 27</span> </span><span class="WHIT">	</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 28</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 29</span>
<span class='line'> 30</span> </span><span class="COMM">// PACKAGER_RENAME( CKEDITOR.ui )</span><span class="WHIT">
<span class='line'> 31</span>
<span class='line'> 32</span> </span><span class="NAME">CKEDITOR.ui.prototype</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT">
<span class='line'> 33</span> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 34</span> </span><span class="WHIT">	</span><span class="COMM">/**
<span class='line'> 35</span> 	 * Adds a UI item to the items collection. These items can be later used in
<span class='line'> 36</span> 	 * the interface.
<span class='line'> 37</span> 	 * @param {String} name The UI item name.
<span class='line'> 38</span> 	 * @param {Object} type The item type.
<span class='line'> 39</span> 	 * @param {Object} definition The item definition. The properties of this
<span class='line'> 40</span> 	 *		object depend on the item type.
<span class='line'> 41</span> 	 * @example
<span class='line'> 42</span> 	 * // Add a new button named "MyBold".
<span class='line'> 43</span> 	 * editorInstance.ui.add( 'MyBold', CKEDITOR.UI_BUTTON,
<span class='line'> 44</span> 	 *     {
<span class='line'> 45</span> 	 *         label : 'My Bold',
<span class='line'> 46</span> 	 *         command : 'bold'
<span class='line'> 47</span> 	 *     });
<span class='line'> 48</span> 	 */</span><span class="WHIT">
<span class='line'> 49</span> </span><span class="WHIT">	</span><span class="NAME">add</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="WHIT"> </span><span class="NAME">name</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">type</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">definition</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="WHIT">
<span class='line'> 50</span> </span><span class="WHIT">	</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 51</span> </span><span class="WHIT">		</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">item</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this._.handlers</span><span class="PUNC">[</span><span class="WHIT"> </span><span class="NAME">type</span><span class="WHIT"> </span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">create</span><span class="PUNC">(</span><span class="WHIT"> </span><span class="NAME">definition</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 52</span> </span><span class="WHIT">		</span><span class="NAME">item.name</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">name</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 53</span> </span><span class="WHIT">		</span><span class="NAME">this._.items</span><span class="PUNC">[</span><span class="WHIT"> </span><span class="NAME">name</span><span class="WHIT"> </span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">item</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 54</span> </span><span class="WHIT">	</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 55</span>
<span class='line'> 56</span> </span><span class="WHIT">	</span><span class="COMM">/**
<span class='line'> 57</span> 	 * Gets a UI object.
<span class='line'> 58</span> 	 * @param {String} name The UI item hame.
<span class='line'> 59</span> 	 * @example
<span class='line'> 60</span> 	 */</span><span class="WHIT">
<span class='line'> 61</span> </span><span class="WHIT">	</span><span class="NAME">get</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="WHIT"> </span><span class="NAME">name</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="WHIT">
<span class='line'> 62</span> </span><span class="WHIT">	</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 63</span> </span><span class="WHIT">		</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">this._.items</span><span class="PUNC">[</span><span class="WHIT"> </span><span class="NAME">name</span><span class="WHIT"> </span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 64</span> </span><span class="WHIT">	</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 65</span>
<span class='line'> 66</span> </span><span class="WHIT">	</span><span class="COMM">/**
<span class='line'> 67</span> 	 * Adds a handler for a UI item type. The handler is responsible for
<span class='line'> 68</span> 	 * transforming UI item definitions in UI objects.
<span class='line'> 69</span> 	 * @param {Object} type The item type.
<span class='line'> 70</span> 	 * @param {Object} handler The handler definition.
<span class='line'> 71</span> 	 * @example
<span class='line'> 72</span> 	 */</span><span class="WHIT">
<span class='line'> 73</span> </span><span class="WHIT">	</span><span class="NAME">addHandler</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="WHIT"> </span><span class="NAME">type</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">handler</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="WHIT">
<span class='line'> 74</span> </span><span class="WHIT">	</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 75</span> </span><span class="WHIT">		</span><span class="NAME">this._.handlers</span><span class="PUNC">[</span><span class="WHIT"> </span><span class="NAME">type</span><span class="WHIT"> </span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">handler</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 76</span> </span><span class="WHIT">	</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'> 77</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 78</span>
<span class='line'> 79</span> </span><span class="COMM">/**
<span class='line'> 80</span>  * (Virtual Class) Do not call this constructor. This class is not really part
<span class='line'> 81</span>  *		of the API. It just illustrates the features of hanlder objects to be
<span class='line'> 82</span>  *		passed to the {@link CKEDITOR.ui.prototype.addHandler} function.
<span class='line'> 83</span>  * @name CKEDITOR.ui.handlerDefinition
<span class='line'> 84</span>  * @constructor
<span class='line'> 85</span>  * @example
<span class='line'> 86</span>  */</span><span class="WHIT">
<span class='line'> 87</span>
<span class='line'> 88</span> </span><span class="WHIT"> </span><span class="COMM">/**
<span class='line'> 89</span>  * Transforms an item definition into an UI item object.
<span class='line'> 90</span>  * @name CKEDITOR.handlerDefinition.prototype.create
<span class='line'> 91</span>  * @function
<span class='line'> 92</span>  * @param {Object} definition The item definition.
<span class='line'> 93</span>  * @example
<span class='line'> 94</span>  * editorInstance.ui.addHandler( CKEDITOR.UI_BUTTON,
<span class='line'> 95</span>  *     {
<span class='line'> 96</span>  *         create : function( definition )
<span class='line'> 97</span>  *         {
<span class='line'> 98</span>  *             return new CKEDITOR.ui.button( definition );
<span class='line'> 99</span>  *         }
<span class='line'>100</span>  *     });
<span class='line'>101</span>  */</span><span class="WHIT">
<span class='line'>102</span> </span></pre></body></html>
